dnd: Hide the drag window when we're done
authorMatthias Clasen <mclasen@redhat.com>
Wed, 16 Mar 2016 20:49:21 +0000 (16:49 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 21 Mar 2016 15:26:24 +0000 (11:26 -0400)
We were just relying on the drag context finalize() to destroy
the window. But with garbage-collected bindings, that might
not happen as soon as we like, so explicitly hide the window
when the drag ends successfully.

https://bugzilla.gnome.org/show_bug.cgi?id=763659

gdk/wayland/gdkdnd-wayland.c
gdk/x11/gdkdnd-x11.c

index 2a2bad51e63e38393f87550bb7fa2057ed1381a0..069828d1af284857b8460e7bddab32105845ea78 100644 (file)
@@ -445,6 +445,19 @@ gdk_wayland_drag_context_cancel (GdkDragContext      *context,
   gdk_drag_context_set_cursor (context, NULL);
 }
 
+static void
+gdk_wayland_drag_context_drop_done (GdkDragContext *context,
+                                    gboolean        success)
+{
+  GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
+
+  if (success)
+    {
+      if (context_wayland->dnd_window)
+        gdk_window_hide (context_wayland->dnd_window);
+    }
+}
+
 static void
 gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
 {
@@ -464,6 +477,7 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
   context_class->get_selection = gdk_wayland_drag_context_get_selection;
   context_class->get_drag_window = gdk_wayland_drag_context_get_drag_window;
   context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
+  context_class->drop_done = gdk_wayland_drag_context_drop_done;
   context_class->manage_dnd = gdk_wayland_drag_context_manage_dnd;
   context_class->set_cursor = gdk_wayland_drag_context_set_cursor;
   context_class->action_changed = gdk_wayland_drag_context_action_changed;
index eceb8e9b5525083c558d0480793b4b05fb300e13..c2a69193d2e3b639e30f12e863b4bf368529a48e 100644 (file)
@@ -2616,7 +2616,10 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
   cairo_t *cr;
 
   if (success)
-    return;
+    {
+      gdk_window_hide (x11_context->drag_window);
+      return;
+    }
 
   win_surface = _gdk_window_ref_cairo_surface (x11_context->drag_window);
   surface = gdk_window_create_similar_surface (x11_context->drag_window,